/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cl.dfg.twittersneps;

import net.contentobjects.jnotify.JNotifyListener;

/**
 *
 * @author Guillermo
 */
class Listener implements JNotifyListener {
    static TwittersnepsApp sneps = new TwittersnepsApp();
    String path;
    FileRW fileRW;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public void fileRenamed(int wd, String rootPath, String oldName,
        String newName) {
      print("renamed " + rootPath + " : " + oldName + " -> " + newName);
    }
    public void fileModified(int wd, String rootPath, String name) {
      print("modified " + rootPath + " : " + name);
      String text = fileRW.readFile(path);
      sneps.view.jTextPane3.setText(text);
    }
    public void fileDeleted(int wd, String rootPath, String name) {
      print("deleted " + rootPath + " : " + name);
    }
    public void fileCreated(int wd, String rootPath, String name) {
      print("created " + rootPath + " : " + name);
    }
    void print(String msg) {
      System.err.println(msg);
    }
  }
